Enable CR4.VME to improve the performance of vm86 emulation.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 14 Jul 2005 08:00:23 +0000 (08:00 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 14 Jul 2005 08:00:23 +0000 (08:00 +0000)
Setting this bit eliminates the calls to the vm86 monitor to handle
interrupts and exceptions that occur while executing programs in vm86
mode.

Signed-off-by: Asit Mallick <asit.k.mallick@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
tools/firmware/vmxassist/Makefile
tools/firmware/vmxassist/machine.h
tools/firmware/vmxassist/setup.c

index 17ef50b76b1e90be35315723327ce5145991db67..e5560a946342ac43f30f94fd0501078a801f8adb 100644 (file)
@@ -24,7 +24,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 # The emulator code lives in ROM space
 TEXTADDR=0x000D0000
 
-DEFINES=-DDEBUG -DTEXTADDR=${TEXTADDR} -D_ACPI_
+DEFINES=-DDEBUG -DENABLE_VME -DTEXTADDR=${TEXTADDR}
 XENINC=-I$(XEN_ROOT)/xen/include -I$(XEN_ROOT)/tools/libxc
 #DEFINES=-DDEBUG -DTEST -DTEXTADDR=${TEXTADDR}
 #XENINC=-I/home/leendert/xen/xeno-unstable.bk/xen/include
index 5d448ef13b203f7f0a49ea17d6efc33cb83ae79d..fd5779af6f88f8a77d4946dbe6b9259e835caad4 100644 (file)
@@ -40,7 +40,8 @@
 #define EFLAGS_TF      (1 << 8)
 #define EFLAGS_IF      (1 << 9)
 #define EFLAGS_DF      (1 << 10)
-#define EFLAGS_VM      (1 << 17)
+#define EFLAGS_IOPL (3 << 12)
+#define EFLAGS_VM      ((1 << 17) | EFLAGS_IOPL)
 #define EFLAGS_VIF     (1 << 19)
 #define EFLAGS_VIP     (1 << 20)
 
@@ -109,6 +110,9 @@ struct tss {
        unsigned short  _5;
        unsigned short  _6;
        unsigned short  iomap_base;
+#ifdef ENABLE_VME
+       unsigned long   int_redir[8];
+#endif
        unsigned char   iomap[8192];
 };
 
@@ -177,7 +181,6 @@ get_cr4(void)
         return rv;
 }
 
-#ifdef TEST
 static inline void
 set_cr3(unsigned addr)
 {
@@ -190,6 +193,7 @@ set_cr4(unsigned value)
        __asm__ __volatile__("movl %0, %%cr4" : /* no outputs */ : "r"(value));
 }
 
+#ifdef TEST
 static inline void
 breakpoint(void)
 {
index f572ae1698653e32091e285f6d24eb6e69b9aaa7..19324d1d5c95fe38c90e95cd454fe81352df22d1 100644 (file)
@@ -121,7 +121,7 @@ void
 setup_gdt(void)
 {
        /* setup task state segment */
-       memset(&tss, 0, sizeof(0));
+       memset(&tss, 0, sizeof(tss));
        tss.ss0 = DATA_SELECTOR;
        tss.esp0 = (unsigned) stack_top - 4*4;
        tss.iomap_base = offsetof(struct tss, iomap);
@@ -353,6 +353,9 @@ main()
 #endif
        setup_gdt();
        setup_idt();
+#ifdef ENABLE_VME
+       set_cr4(get_cr4() | CR4_VME); 
+#endif
        setup_ctx();
        setup_pic();
        start_bios();